package com.cloudkinto.vo.cost;

import com.cloudkinto.common.utils.MathUtils;
import com.cloudkinto.common.utils.dict.StaticDict;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
public class CostItemRes {
    private Long id;
    @ApiModelProperty("计费项")
    private String itemName;
    @ApiModelProperty("单据类型")
    private String billTypeName;
    private Integer billType;
    @ApiModelProperty("出库入库-计费明细/ 工单-计费变量")
    private String callDetail;
    @ApiModelProperty("总费用")
    private Double totalFee;
    @ApiModelProperty("币种")
    private String currencyCode;
    @ApiModelProperty("备注")
    private String tips;
    @ApiModelProperty("计费时间")
    private Date createTime;
    @ApiModelProperty("仓储 计算单位 0立方米/天  1立方英尺/天")
    private Integer calculateUnit;
    @ApiModelProperty("仓储计算方式 0 按体积")
    private Integer calculateWay;
    @ApiModelProperty("仓储 总体积")
    private Double totalVolume;
    @ApiModelProperty("仓储 计费体积/ 工单-数量")
    private Double calVolume;
    @ApiModelProperty("工单-单价")
    private double unitPrice;

    public double getUnitPrice() {
        if (calVolume == null) return 0d;
        return MathUtils.numberFormat(totalFee / calVolume, 2);
    }

    public String getBillTypeName() {
        if (billType == null) return "--";
        if (1001 == billType) {
            return "手动补录";
        }
        return StaticDict.OperateBill_Type.getText(billType);
    }
}
